<?php
namespace Common\Model;

class MessageModel extends BaseModel{

	protected $tableName = "message";

	protected $_validate = array(
		array('name','require','姓名必填',self::MODEL_INSERT),
		//array('idcard','require','学号必填',self::MODEL_INSERT),
		array('content','require','反馈内容必填',self::MODEL_INSERT),
	);

	protected $_auto = array(
        array('content', 'htmlspecialchars_decode', self::MODEL_BOTH, 'function'),
		array('createtime','time',1,'function'),
		array('updatetime','time',3,'function'),
	);

	protected function getStatus(){
		if ($_POST['reply']) {
			return "1";
		}else{
			return "0";
		}
	}

	public function getListByMap($condition='',$field='*',$limit='10',$order='id desc'){
		$data = $this->where($condition)->field($field)->limit($limit)->order($order)->select();
		return $data;
	}
}